-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rector: CQ - SimplifyIfReturnBoolRector #4152
Conversation
* Rector: CQ - UnusedForeachValueToArrayKeysRector See Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector * fixes + phpstan See fix at rector: rectorphp/rector-src#6164
This reverts commit 3d7eaf6.
@kiatng can we continue w/o DeMorgan's Law? |
I cannot give my approval because in my opinion, some changes are worse than the current original code. |
B/c of 6 out of +100 improvements? Dont get me wrong, i agree with your suggestions, but i dont want to mix it up with automatic fixes. How about to merge and verify your manual changes again? |
... at the other hand ... we can leave it open. With rector added as dependency we can skip it for now. |
Or submit a PR to improve Rector (which I cannot do). |
I'd really like to do, but i am not so familiar with rectors internal functionality. I think i can write simple custom rules, but in this case ... there are a lot of possibly combinations of "&&", "||" that makes it difficult to make it safe for a general rule. I guess thats the reason why your issue has been closed. The current rule works, but - as you have seen - it does only covers some "easy" patterns. We can add this rule, but it will only cover 2 (?) out of your 6 suggestions. |
this PR makes the code much harder to read, the benefit is only for the machine, not for the humans. |
Disagree. Most of the changes look better to me.
|
It's a negated true/false expression? So what? |
because I'm stupid I think that a negated OR is far less readable. but better make the code 1 line less but much harder to read so that only geniuses will take the time to read it. again, the code is not for the machines, it's for the people, it should be understandable easily for the people. only because rector has that rule it doesn't mean it should be applied. |
I did not say you're stupid ... you're not. I'd like to use rector to unify code. For core, for extensions ... |
I need to call out @sreichel comment:
Even though it is a simple question, it is irrelevant. The question carries with it negative implications, which are not within standards of our CoC:
and in particular the second standard:
Note that our CoC was based on v1.4. The latest version is 2.1. I encourage everyone here take the time to read it and think about it. The second standard in this version includes "opinions":
I urge all of us use language, English as well as PHP, that complies to the best standards. |
There was no "negative implications"! It was a serious question. If you disagree with that change, it is fine. However ... |
Maybe you got me wrong? This PR would have added 7 negated return statements. My question was how often you face these seven particular lines during development, When you serach the codebase for |
See:
Rector;